import request from "@/utils/request";

// 获取二维码 key
export const getQrCodeKey = () => {
  return request({
    url: "/login/qr/key",
    timestamp: Date.now(),
  });
};

// 获取二维码
export const getQrCode = (obj) => {
  return request({
    url: "/login/qr/create",
    data: {
      ...obj,
      timestamp: Date.now(),
    },
  });
};

// 检测扫描状态
export const checkScanStatus = (obj) => {
  return request({
    url: "/login/qr/check",
    data: {
      ...obj,
      timestamp: Date.now(),
      noCookie: true,
    },
  });
};

// 登录接口
export const login = (obj) => {
  return request({
    url: "/login/cellphone",
    method: "POST",
    data: {
      ...obj,
    },
  });
};

// 获取登录状态
export const getLoginStatusApi = (obj) => {
  return request({
    url: "/login/status",
    data: {
      ...obj,
    },
  });
};

// 获取用户信息
export const getUserInfoApi = (obj) => {
  return request({
    url: "/user/detail",
    data: {
      ...obj,
    },
  });
};
